Module: RGData::API::ClassMethods
- Defined in:
- lib/rgdata/api.rb
Instance Attribute Summary collapse
-
#model ⇒ Object
Returns the value of attribute model.
-
#scope ⇒ Object
Returns the value of attribute scope.
Instance Method Summary collapse
-
#do_request(domain, options) ⇒ Object
Send request and return response.
- #request_url(redirect_uri) ⇒ Object
-
#retrieve(domain, options) ⇒ Object
Perform request and instantiate new model objects.
Instance Attribute Details
#model ⇒ Object
Returns the value of attribute model.
15 16 17 |
# File 'lib/rgdata/api.rb', line 15 def model @model end |
#scope ⇒ Object
Returns the value of attribute scope.
14 15 16 |
# File 'lib/rgdata/api.rb', line 14 def scope @scope end |
Instance Method Details
#do_request(domain, options) ⇒ Object
Send request and return response. options can be :oauth_token, :access_token, or :refresh_token.
23 24 25 26 27 28 |
# File 'lib/rgdata/api.rb', line 23 def do_request(domain, ) oauth_token = extract_oauth_token_or_access_token_or_get_one_using_refresh_token() query = {oauth_token: oauth_token} query.verify_keys_present_and_values_not_nil(:oauth_token) get "/#{domain}/full", query: query end |
#request_url(redirect_uri) ⇒ Object
17 18 19 |
# File 'lib/rgdata/api.rb', line 17 def request_url(redirect_uri) RGData::Authentication.request_url(scope, redirect_uri) end |
#retrieve(domain, options) ⇒ Object
Perform request and instantiate new model objects.
31 32 33 34 35 36 |
# File 'lib/rgdata/api.rb', line 31 def retrieve(domain, ) full_xml_hash = do_request(domain, ) full_xml_hash['feed']['entry'].map do |xml_hash| model.new_from_xml_hash xml_hash end end |