Skip to content

Commit

Permalink
Changes to allow the gem to work on Ruby 1.8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
bengreenberg committed Aug 18, 2013
1 parent dc8e4e0 commit f4540ed
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions lib/nacre/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ class Api
def initialize args
@config = Nacre::Config.new(args)
@connection = Nacre::Connection.new({
auth_data: auth_data,
auth_url: @config.auth_url,
api_url: @config.api_url
:auth_data => auth_data,
:auth_url => @config.auth_url,
:api_url => @config.api_url
})

@connection.authenticate
Expand All @@ -29,9 +29,9 @@ def self.global_instance

def auth_data
{
apiAccountCredentials: {
emailAddress: @config.email,
password: @config.password
:apiAccountCredentials => {
:emailAddress => @config.email,
:password => @config.password
}
}
end
Expand Down
6 changes: 3 additions & 3 deletions lib/nacre/api/order_service_resources/order_search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class OrderSearch
def initialize(search_url, query = nil, max_results = 200, starting_page = 1)
@search_url = search_url
@query = query
@params = build_params( max_results: max_results, starting_page: starting_page )
@params = build_params( :max_results => max_results, :starting_page => starting_page )
end

def self.connection
Expand Down Expand Up @@ -43,8 +43,8 @@ def build_params args

def map_to_bp_param param_key
bp_map = {
max_results: 'pageSize',
starting_page: 'firstResult'
:max_results => 'pageSize',
:starting_page => 'firstResult'
}
bp_map[param_key] || param_key.to_s
end
Expand Down
2 changes: 1 addition & 1 deletion lib/nacre/api/service_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def self.find_many(id_set)

def load_values(values)
self.class.fields.each do |field|
self.public_send "#{field.to_s}=", values[field.to_s.camelize(:lower)].to_openstruct
self.send "#{field.to_s}=", values[field.to_s.camelize(:lower)].to_openstruct
end
end

Expand Down
4 changes: 2 additions & 2 deletions lib/nacre/config.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'psych'
#require 'psych'

module Nacre
class Config
Expand Down Expand Up @@ -47,7 +47,7 @@ def auth_url
private

def load_file file
config = Psych.load( File.open(file,'r').read )
config = YAML.load( File.open(file,'r').read )
load_values config
return true
end
Expand Down

0 comments on commit f4540ed

Please sign in to comment.