Class: Megam::RestAdapter
- Inherits:
-
Object
- Object
- Megam::RestAdapter
- Defined in:
- lib/megam/core/rest_adapter.rb
Direct Known Subclasses
Account, Addons, Assemblies, Assembly, Balances, Billedhistories, Billingtransactions, Components, Disks, Domains, EventsAll, EventsBilling, EventsContainer, EventsStorage, EventsVm, MarketPlace, Organizations, Promos, Request, Sensors, Snapshots, SshKey, Subscriptions
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#master_key ⇒ Object
readonly
Returns the value of attribute master_key.
-
#org_id ⇒ Object
readonly
Returns the value of attribute org_id.
-
#password_hash ⇒ Object
readonly
the name :password is used as attr_accessor in accounts, hence we use gpassword.
Instance Method Summary collapse
-
#initialize(o) ⇒ RestAdapter
constructor
clean up this module later.
-
#megam_rest ⇒ Object
Build a megam api client.
Constructor Details
#initialize(o) ⇒ RestAdapter
clean up this module later.
15 16 17 18 19 20 21 22 23 |
# File 'lib/megam/core/rest_adapter.rb', line 15 def initialize(o) @email = o[:email] @api_key = o[:api_key] || nil @master_key = o[:master_key] || nil @host = o[:host] @password_hash = o[:password_hash] || nil @org_id = o[:org_id] @headers = o[:headers] end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
4 5 6 |
# File 'lib/megam/core/rest_adapter.rb', line 4 def api_key @api_key end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
3 4 5 |
# File 'lib/megam/core/rest_adapter.rb', line 3 def email @email end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
11 12 13 |
# File 'lib/megam/core/rest_adapter.rb', line 11 def headers @headers end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
5 6 7 |
# File 'lib/megam/core/rest_adapter.rb', line 5 def host @host end |
#master_key ⇒ Object (readonly)
Returns the value of attribute master_key.
9 10 11 |
# File 'lib/megam/core/rest_adapter.rb', line 9 def master_key @master_key end |
#org_id ⇒ Object (readonly)
Returns the value of attribute org_id.
10 11 12 |
# File 'lib/megam/core/rest_adapter.rb', line 10 def org_id @org_id end |
#password_hash ⇒ Object (readonly)
the name :password is used as attr_accessor in accounts, hence we use gpassword
8 9 10 |
# File 'lib/megam/core/rest_adapter.rb', line 8 def password_hash @password_hash end |
Instance Method Details
#megam_rest ⇒ Object
Build a megam api client
Parameters
- api
-
The Megam::API client
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/megam/core/rest_adapter.rb', line 29 def megam_rest = { :email => email, :api_key => api_key, :org_id => org_id, :password_hash => password_hash, :master_key => master_key, :host => host } if headers [:headers] = headers end Megam::API.new() end |