Class: ZaloAPI::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/zalo_api/resource.rb

Direct Known Subclasses

OA

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, attributes = {}) ⇒ Resource

Create a new resource instance.

Parameters:

  • client (Client)

    The client to use

  • attributes (Hash) (defaults to: {})

    The optional attributes that describe the resource



10
11
12
13
14
15
# File 'lib/zalo_api/resource.rb', line 10

def initialize(client, attributes = {})
  raise "Expected a Hash for attributes, got #{attributes.inspect}" unless attributes.is_a?(Hash)

  @client = client
  @attributes = attributes
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



5
6
7
# File 'lib/zalo_api/resource.rb', line 5

def attributes
  @attributes
end

Instance Method Details

#base_urlObject



17
18
19
20
# File 'lib/zalo_api/resource.rb', line 17

def base_url
  @base_url ||= "%s/%s" % [ZaloAPI::Config::OA_API_BASE, ZaloAPI::Config::OA_API_VERSION]
  return @base_url
end