Class: AppleNews::Request::Post
- Inherits:
-
Object
- Object
- AppleNews::Request::Post
- Defined in:
- lib/apple-news/requests/post.rb
Instance Attribute Summary collapse
-
#fields ⇒ Object
Returns the value of attribute fields.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(url, config = AppleNews.config) ⇒ Post
constructor
A new instance of Post.
Constructor Details
Instance Attribute Details
#fields ⇒ Object
Returns the value of attribute fields.
5 6 7 |
# File 'lib/apple-news/requests/post.rb', line 5 def fields @fields end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
4 5 6 |
# File 'lib/apple-news/requests/post.rb', line 4 def url @url end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/apple-news/requests/post.rb', line 13 def call http = Net::HTTP.new(@url.hostname, @url.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_PEER # The API can be really slow, sometimes. http.read_timeout = 120 res = http.post(@url, content_body, headers) JSON.parse(res.body) end |