Class: SoapboxApi::UsersPosts
- Inherits:
-
Object
- Object
- SoapboxApi::UsersPosts
- Defined in:
- lib/soapbox_api.rb
Instance Attribute Summary collapse
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
- #fetch_posts ⇒ Object
-
#initialize(token) ⇒ UsersPosts
constructor
A new instance of UsersPosts.
Constructor Details
#initialize(token) ⇒ UsersPosts
Returns a new instance of UsersPosts.
10 11 12 |
# File 'lib/soapbox_api.rb', line 10 def initialize(token) @token = token end |
Instance Attribute Details
#token ⇒ Object (readonly)
Returns the value of attribute token.
8 9 10 |
# File 'lib/soapbox_api.rb', line 8 def token @token end |
Instance Method Details
#fetch_posts ⇒ Object
14 15 16 17 18 |
# File 'lib/soapbox_api.rb', line 14 def fetch_posts result = JSON.parse(Nokogiri::HTML(open('http://localhost:3000/api/fetch_posts.json?consumer_key=' + token[:consumer_key] + '&consumer_secret=' + token[:consumer_secret]))) raise "401: Not authorized" if (result.empty?) result end |