Class: Dagpi::Client
- Inherits:
-
Object
- Object
- Dagpi::Client
- Defined in:
- lib/dagpirb.rb
Instance Attribute Summary collapse
-
#__version__ ⇒ Object
readonly
Returns the value of attribute __version__.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
-
#get_data(endpoint) ⇒ Hash
Request data from Data API.
-
#get_image(endpoint, url) ⇒ bytes
Request image data from Image API.
-
#initialize(token) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(token) ⇒ Client
Returns a new instance of Client.
7 8 9 10 11 |
# File 'lib/dagpirb.rb', line 7 def initialize(token) @token = token @client = Dagpi::HTTPClient.new @token @__version__ = VERSION end |
Instance Attribute Details
#__version__ ⇒ Object (readonly)
Returns the value of attribute __version__.
6 7 8 |
# File 'lib/dagpirb.rb', line 6 def __version__ @__version__ end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
6 7 8 |
# File 'lib/dagpirb.rb', line 6 def token @token end |
Instance Method Details
#get_data(endpoint) ⇒ Hash
Request data from Data API
17 18 19 |
# File 'lib/dagpirb.rb', line 17 def get_data(endpoint) @client.get_data(endpoint) end |
#get_image(endpoint, url) ⇒ bytes
Request image data from Image API
26 27 28 |
# File 'lib/dagpirb.rb', line 26 def get_image(endpoint, url) @client.get_image(endpoint, url) end |