Class: Brickset::Client
- Inherits:
-
Object
- Object
- Brickset::Client
- Includes:
- HTTParty
- Defined in:
- lib/brickset/client.rb
Instance Method Summary collapse
- #get_recently_updated_sets(minutes_ago) ⇒ Object
- #get_sets(options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/brickset/client.rb', line 10 def initialize( = {}) # Merge the config values from the module and those passed # to the client. = Brickset..merge() # Copy the merged values to this client and ignore those # not part of our configuration Configuration::VALID_CONFIG_KEYS.each do |key| send("#{key}=", [key]) end end |
Instance Method Details
#get_recently_updated_sets(minutes_ago) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/brickset/client.rb', line 34 def get_recently_updated_sets minutes_ago response = call_api :getRecentlyUpdatedSets, { minutesAgo: minutes_ago } if response["ArrayOfSets"].nil? [] else response["ArrayOfSets"]["sets"] end end |
#get_sets(options = {}) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/brickset/client.rb', line 22 def get_sets = {} required_params = [:userHash, :query, :theme, :subtheme, :setNumber, :year, :owned, :wanted, :orderBy, :pageSize, :pageNumber, :userName] = {} required_params.each { |param| [param] = nil } response = call_api(:getSets, .merge()) if response["ArrayOfSets"].nil? [] else response["ArrayOfSets"]["sets"] end end |