Class: Peddler::JSONFeedDocument
- Inherits:
-
Object
- Object
- Peddler::JSONFeedDocument
- Defined in:
- lib/peddler/json_feed_document.rb
Constant Summary collapse
- CONTENT_TYPE =
"application/json; charset=UTF-8"
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(api) ⇒ JSONFeedDocument
constructor
A new instance of JSONFeedDocument.
- #upload(content) ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(api) ⇒ JSONFeedDocument
Returns a new instance of JSONFeedDocument.
13 14 15 |
# File 'lib/peddler/json_feed_document.rb', line 13 def initialize(api) @api = api end |
Instance Method Details
#id ⇒ Object
17 18 19 |
# File 'lib/peddler/json_feed_document.rb', line 17 def id .fetch("id") end |
#upload(content) ⇒ Object
7 8 9 10 11 |
# File 'lib/peddler/json_feed_document.rb', line 7 def upload(content) # While HTTPrb already sets the content-type, Amazon server seems to fail if we don't explicitly set it again # here. A bit of a mystery; maybe it's the order of the headers that's screwing things up on their end? HTTP.headers("Content-Type" => CONTENT_TYPE).put(url, json: content) end |
#url ⇒ Object
21 22 23 |
# File 'lib/peddler/json_feed_document.rb', line 21 def url .fetch("url") end |