Class: SmsAero::Response

Inherits:
Object
  • Object
show all
Extended by:
Dry::Initializer, Optional
Defined in:
lib/sms_aero/response.rb

Defined Under Namespace

Classes: WithBalance, WithGroups, WithId, WithSenders, WithStatuses, WithTariff

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build(*res) ⇒ Object



12
13
14
15
# File 'lib/sms_aero/response.rb', line 12

def build(*res)
  body = res.last
  new JSON.parse(body.first)
end

.new(opts) ⇒ Object



17
18
19
20
# File 'lib/sms_aero/response.rb', line 17

def new(opts)
  super \
    opts.each_with_object({}) { |(key, val), obj| obj[key.to_sym] = val }
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/sms_aero/response.rb', line 7

def success?
  result == "accepted"
end