Class: Ebay
- Inherits:
-
Object
- Object
- Ebay
- Defined in:
- lib/ebayer/get_user_profile.rb
Instance Attribute Summary collapse
-
#app_id ⇒ Object
Returns the value of attribute app_id.
-
#callname ⇒ Object
Returns the value of attribute callname.
-
#open_url ⇒ Object
Returns the value of attribute open_url.
-
#response ⇒ Object
Returns the value of attribute response.
-
#response_encoding ⇒ Object
Returns the value of attribute response_encoding.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
Instance Method Summary collapse
-
#initialize(open_url, callname, response_encoding, api_version, app_id, user_id) ⇒ Ebay
constructor
A new instance of Ebay.
- #request_ebay ⇒ Object
- #response_parser(response_content) ⇒ Object
- #success? ⇒ Boolean
- #url_definer ⇒ Object
- #user_information ⇒ Object
Constructor Details
#initialize(open_url, callname, response_encoding, api_version, app_id, user_id) ⇒ Ebay
Returns a new instance of Ebay.
6 7 8 9 10 11 12 13 |
# File 'lib/ebayer/get_user_profile.rb', line 6 def initialize(open_url, callname, response_encoding, api_version, app_id, user_id) @open_url = open_url @callname = callname @response_encoding= response_encoding @api_version = api_version @app_id = app_id @user_id = user_id end |
Instance Attribute Details
#app_id ⇒ Object
Returns the value of attribute app_id.
3 4 5 |
# File 'lib/ebayer/get_user_profile.rb', line 3 def app_id @app_id end |
#callname ⇒ Object
Returns the value of attribute callname.
3 4 5 |
# File 'lib/ebayer/get_user_profile.rb', line 3 def callname @callname end |
#open_url ⇒ Object
Returns the value of attribute open_url.
3 4 5 |
# File 'lib/ebayer/get_user_profile.rb', line 3 def open_url @open_url end |
#response ⇒ Object
Returns the value of attribute response.
3 4 5 |
# File 'lib/ebayer/get_user_profile.rb', line 3 def response @response end |
#response_encoding ⇒ Object
Returns the value of attribute response_encoding.
3 4 5 |
# File 'lib/ebayer/get_user_profile.rb', line 3 def response_encoding @response_encoding end |
#user_id ⇒ Object
Returns the value of attribute user_id.
3 4 5 |
# File 'lib/ebayer/get_user_profile.rb', line 3 def user_id @user_id end |
Instance Method Details
#request_ebay ⇒ Object
22 23 24 25 26 |
# File 'lib/ebayer/get_user_profile.rb', line 22 def request_ebay requested_url = self.url_definer new_response = HTTParty.get(requested_url) @response = self.response_parser(new_response.body) end |
#response_parser(response_content) ⇒ Object
28 29 30 |
# File 'lib/ebayer/get_user_profile.rb', line 28 def response_parser(response_content) Hashie::Mash.new(JSON(response_content)) end |
#success? ⇒ Boolean
32 33 34 |
# File 'lib/ebayer/get_user_profile.rb', line 32 def success? self.response_content ? (self.response_content["Ack"] == "Success") : (self.response_content["Ack"] == "Failure") end |
#url_definer ⇒ Object
17 18 19 20 |
# File 'lib/ebayer/get_user_profile.rb', line 17 def url_definer url = @open_url+"?callname=#{@callname}&responseencoding=#{@response_encoding}&appid=#{@app_id}&siteid=0&UserID=#{@user_id}&IncludeSelector=Details&version=#{@api_version}" return url end |
#user_information ⇒ Object
36 37 38 |
# File 'lib/ebayer/get_user_profile.rb', line 36 def user_information self.request_ebay end |