{"action":"created","issue":{"url":"https://api.github.com/repos/textmagic/textmagic-rest-ruby/issues/2","labels_url":"https://api.github.com/repos/textmagic/textmagic-rest-ruby/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/textmagic/textmagic-rest-ruby/issues/2/comments","events_url":"https://api.github.com/repos/textmagic/textmagic-rest-ruby/issues/2/events","html_url":"https://github.com/textmagic/textmagic-rest-ruby/issues/2","id":107357308,"number":2,"title":"Change client.messages.create to client.create_message() and message.send()?","user":{"login":"matthewcummings","id":1292655,"avatar_url":"https://avatars.githubusercontent.com/u/1292655?v=3","gravatar_id":"","url":"https://api.github.com/users/matthewcummings","html_url":"https://github.com/matthewcummings","followers_url":"https://api.github.com/users/matthewcummings/followers","following_url":"https://api.github.com/users/matthewcummings/following{/other_user}","gists_url":"https://api.github.com/users/matthewcummings/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewcummings/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewcummings/subscriptions","organizations_url":"https://api.github.com/users/matthewcummings/orgs","repos_url":"https://api.github.com/users/matthewcummings/repos","events_url":"https://api.github.com/users/matthewcummings/events{/privacy}","received_events_url":"https://api.github.com/users/matthewcummings/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-19T21:37:06Z","updated_at":"2015-09-21T05:34:44Z","closed_at":null,"body":"The current Ruby interface feels a bit awkward, to create AND send a message, you do this:\r\n```\r\nclient = Textmagic::REST::Client.new username, token\r\nparams = {:phones => '999999999, :text => 'Hello from TextMagic Ruby.'}\r\nmessage = client.messages.create(params)\r\n```\r\n \r\nIt would feel a bit more object oriented to make it work something like this:\r\n```\r\nclient = Textmagic::REST::Client.new username, token\r\nparams = {:phones => '999999999, :text => 'Hello from TextMagic Ruby.'}\r\nmessage = client.create_message(params)\r\nmessage.send()\r\n```\r\n\r\nI'm not  yet sure how well that will fit with the underlying REST model, but when I see the client.messages.create() method, two issues come to mind:\r\n1. Why isn't create() available on the client object itself?\r\n2. I don't expect the create() method to actually send the message.\r\n\r\nOpen to suggestions/comments on this."},"comment":{"url":"https://api.github.com/repos/textmagic/textmagic-rest-ruby/issues/comments/141880888","html_url":"https://github.com/textmagic/textmagic-rest-ruby/issues/2#issuecomment-141880888","issue_url":"https://api.github.com/repos/textmagic/textmagic-rest-ruby/issues/2","id":141880888,"user":{"login":"andreylarionov","id":5106366,"avatar_url":"https://avatars.githubusercontent.com/u/5106366?v=3","gravatar_id":"","url":"https://api.github.com/users/andreylarionov","html_url":"https://github.com/andreylarionov","followers_url":"https://api.github.com/users/andreylarionov/followers","following_url":"https://api.github.com/users/andreylarionov/following{/other_user}","gists_url":"https://api.github.com/users/andreylarionov/gists{/gist_id}","starred_url":"https://api.github.com/users/andreylarionov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreylarionov/subscriptions","organizations_url":"https://api.github.com/users/andreylarionov/orgs","repos_url":"https://api.github.com/users/andreylarionov/repos","events_url":"https://api.github.com/users/andreylarionov/events{/privacy}","received_events_url":"https://api.github.com/users/andreylarionov/received_events","type":"User","site_admin":false},"created_at":"2015-09-21T05:34:44Z","updated_at":"2015-09-21T05:34:44Z","body":"I think the existing architecture is more convenient to understand and flexible to change (add/edit/delete methods). We have a client, client has entities ('messages', 'contacts' etc), each entity has methods (in most cases are identical in nature - 'create', 'list', 'get'). Regarding create of message, if you specify sendingTime parameter in future then your message will be sent later, but if you don't specify sendingTime parameter then message will be sent immediately. In both cases messages will be created (that reflects the name of the method). Perhaps it makes sense to add aliases for the most commonly used methods (like client.create_message()) on the client object. But I'm not sure that we need to change the library's architecture."}}