Class: BaseCRM::TextMessagesService
- Inherits:
-
Object
- Object
- BaseCRM::TextMessagesService
- Defined in:
- lib/basecrm/services/text_messages_service.rb
Instance Method Summary collapse
-
#all ⇒ Enumerable
Retrieve text messages.
-
#find(id) ⇒ TextMessage
Retrieve a single text message.
-
#initialize(client) ⇒ TextMessagesService
constructor
A new instance of TextMessagesService.
-
#where(options = {}) ⇒ Array<TextMessage>
Retrieve text messages.
Constructor Details
#initialize(client) ⇒ TextMessagesService
Returns a new instance of TextMessagesService.
5 6 7 |
# File 'lib/basecrm/services/text_messages_service.rb', line 5 def initialize(client) @client = client end |
Instance Method Details
#all ⇒ Enumerable
Retrieve text messages
get ‘/text_messages’
If you want to use filtering or sorting (see #where).
15 16 17 |
# File 'lib/basecrm/services/text_messages_service.rb', line 15 def all PaginatedResource.new(self) end |
#find(id) ⇒ TextMessage
Retrieve a single text message
get ‘/text_messages/BaseCRM#id’
Returns a single text message according to the unique ID provided If the specified user does not exist, this query returns an error
49 50 51 52 53 |
# File 'lib/basecrm/services/text_messages_service.rb', line 49 def find(id) _, _, root = @client.get("/text_messages/#{id}") TextMessage.new(root[:data]) end |
#where(options = {}) ⇒ Array<TextMessage>
Retrieve text messages
get ‘/text_messages’
Returns Text Messages, according to the parameters provided
33 34 35 36 37 |
# File 'lib/basecrm/services/text_messages_service.rb', line 33 def where( = {}) _, _, root = @client.get("/text_messages", ) root[:items].map{ |item| TextMessage.new(item[:data]) } end |