Class: Freee::Response::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/freee/obj/response.rb

Direct Known Subclasses

AccountItem, Transfer, WalletTxn, Walletable

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(val) ⇒ Base

Returns a new instance of Base.



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

def initialize(val)
  @val = Hash.try_convert(val)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



11
12
13
# File 'lib/freee/obj/response.rb', line 11

def method_missing(name, *args)
  @val[name.to_s]
end

Instance Attribute Details

#valObject (readonly)

Returns the value of attribute val.



5
6
7
# File 'lib/freee/obj/response.rb', line 5

def val
  @val
end

Instance Method Details

#[](name) ⇒ Object



15
16
17
# File 'lib/freee/obj/response.rb', line 15

def [](name)
  @val[name.to_s]
end

#has_key?(name) ⇒ Boolean Also known as: key, include?, member?

Returns:

  • (Boolean)


19
20
21
22
23
24
25
# File 'lib/freee/obj/response.rb', line 19

def has_key?(name)
  if @val[name.to_s]
    return true
  else
    return false
  end
end