Class: ShortPixel::Resource
- Inherits:
-
Object
- Object
- ShortPixel::Resource
- Defined in:
- lib/shortpixel/resource.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#initialize(client) ⇒ Resource
constructor
A new instance of Resource.
- #post_request(url, body) ⇒ Object
Constructor Details
#initialize(client) ⇒ Resource
Returns a new instance of Resource.
5 6 7 |
# File 'lib/shortpixel/resource.rb', line 5 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
3 4 5 |
# File 'lib/shortpixel/resource.rb', line 3 def client @client end |
Instance Method Details
#post_request(url, body) ⇒ Object
9 10 11 |
# File 'lib/shortpixel/resource.rb', line 9 def post_request(url, body) client.connection.post(url, body.merge(key: client.api_key)) end |