ecwid_api 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d60dce1b18b8bf9699f9c2b4d9d172e304b8930
4
- data.tar.gz: e88d708e7aaab618524b3066a7580da065eb7f45
3
+ metadata.gz: 46dcd4e6a2d43c7fad4d64e00476a240b0d18c02
4
+ data.tar.gz: ea1cccacb59b117efa147353ad038605a867a957
5
5
  SHA512:
6
- metadata.gz: 6961d44c77a5ca96aa4be870ffc3a4d207014fef70cd4a933ee4721412186b2514927a2e09d2373ff5735795ce45ecf3e6515b310c6c69c67c0780d366bcd93b
7
- data.tar.gz: 76b6fb2275ae4204693e8b96e5c105f7898929d7d767b28857abf41b180e6f29ae3a6273881a2aaa3ed7e5167bc009a6316f23e549eeefa97429caf940603d63
6
+ metadata.gz: c8c88afb4c895ef03be8d767e2d8a347ca4109852813df33fc77126ada5109bc67c5809faaf48f77e2a8152eaea4be1e09e1a2478cf33204c3ac80ab73da6e13
7
+ data.tar.gz: e7a441c8d51c30971954ad531930c7777a5af0abde8d77cfd850ab41c4e382397cdbc3f2d932f9ba7d11aeadf4b1cbefccc123ca6ed3fb60fd8e79d3d0e7b648
@@ -42,24 +42,20 @@ module EcwidApi
42
42
  end
43
43
 
44
44
  # Public: Returns the billing person
45
+ #
46
+ # If there isn't a billing_person, then it assumed to be the shipping_person
47
+ #
45
48
  def billing_person
46
- return unless data["billingPerson"] || data["shippingPerson"]
47
-
48
- @billing_person ||= if data["billingPerson"]
49
- Person.new(data["billingPerson"])
50
- else
51
- shipping_person
52
- end
49
+ build_billing_person || build_shipping_person
53
50
  end
54
51
 
55
52
  # Public: Returns the shipping person
53
+ #
54
+ # If there isn't a shipping_person, then it is assumed to be the
55
+ # billing_person
56
+ #
56
57
  def shipping_person
57
- return unless data["shippingPerson"] || data["billingPerson"]
58
- @shipping_person ||= if data["shippingPerson"]
59
- Person.new(data["shippingPerson"])
60
- else
61
- billing_person
62
- end
58
+ build_shipping_person || build_billing_person
63
59
  end
64
60
 
65
61
  # Public: Returns a Array of `OrderItem` objects
@@ -78,5 +74,15 @@ module EcwidApi
78
74
  def fulfillment_status
79
75
  super && super.downcase.to_sym
80
76
  end
77
+
78
+ private
79
+
80
+ def build_billing_person
81
+ @billing_person ||= data["billingPerson"] && Person.new(data["billingPerson"])
82
+ end
83
+
84
+ def build_shipping_person
85
+ @shipping_person ||= data["shippingPerson"] && Person.new(data["shippingPerson"])
86
+ end
81
87
  end
82
88
  end
@@ -1,3 +1,3 @@
1
1
  module EcwidApi
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -7,7 +7,6 @@
7
7
 
8
8
  require "ecwid_api"
9
9
  require "helpers/client"
10
- require "pry"
11
10
 
12
11
  RSpec.configure do |config|
13
12
  config.treat_symbols_as_metadata_keys_with_true_values = true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecwid_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Biehl