Class: EasySMS::MessageResource

Inherits:
Struct
  • Object
show all
Defined in:
lib/easy_sms/message_resource.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#clientObject

Returns the value of attribute client

Returns:

  • (Object)

    the current value of client



2
3
4
# File 'lib/easy_sms/message_resource.rb', line 2

def client
  @client
end

Instance Method Details

#create(attrs = {}) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/easy_sms/message_resource.rb', line 3

def create(attrs = {})
  res = client.post('/messages', attrs)

  JSON.parse(res).tap do |json|
    json['c_at'] = Time.parse(json['c_at']) if json['c_at']
  end
end