chiketto 0.1.1 → 0.1.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: bec52e272697693165db34995b638267602c1fde
4
- data.tar.gz: 1f7b4a77e8b014eace483465ea53a9680d1201cd
3
+ metadata.gz: 92e0b61671c1bb652bf1cd694ae5847b832ad2c2
4
+ data.tar.gz: 7b7b121ca685c5c96d6d6a37c85f241ece0b1ada
5
5
  SHA512:
6
- metadata.gz: 9b60b74aea97d3f016fdc7d227b081f32f638ed87161e3edad4d6c92eaf74cef3037b2dfa3fd28e3a2c963fb41af88e459c9416a4ec31c6970e89ac9e3a8575c
7
- data.tar.gz: fee79922258e4fe6e5e2e7c3e588a9503861488b0b52b7f038c6c8c1cf5bccac725dd6feaa8e1d1c74dfb97817cc507e3091ed007978c9b86df06b15188aceeb
6
+ metadata.gz: 65366f24528bc323e4d41823dfc3b0860b7bcf95d9c43e45d3c1b02f24707181e7e47a8eecdf5a779fe73d5c5c0217a10312d24e7d26dee591f07f47316c4c34
7
+ data.tar.gz: 503340e8ff16e01534245258fec086bdd6511d935083cb0b7d22225301df35324b212adb945de72a462c89ad3a66c840f53fb740326b1872091677db5ec06a8f
data/lib/chiketto.rb CHANGED
@@ -10,6 +10,7 @@ module Chiketto
10
10
  require 'chiketto/resource'
11
11
  require 'chiketto/address'
12
12
  require 'chiketto/attendee'
13
+ require 'chiketto/attendee_profile'
13
14
  require 'chiketto/category'
14
15
  require 'chiketto/email'
15
16
  require 'chiketto/event'
@@ -1,12 +1,22 @@
1
1
  module Chiketto
2
2
  class Attendee < Resource
3
- attr_accessor :email,
4
- :quantity,
3
+ attr_accessor :quantity,
5
4
  :status,
6
- :ticket_id,
7
- :answers
5
+ :ticket_class_id,
6
+ :event_id,
7
+ :order_id
8
8
 
9
9
  attr_date :changed,
10
10
  :created
11
+
12
+ def profile
13
+ AttendeeProfile.new @profile.to_h
14
+ end
15
+
16
+ def addresses
17
+ @addresses.to_h.inject({}) do |hash, (key, address)|
18
+ hash.merge(key.to_sym => Address.new(address.to_h))
19
+ end
20
+ end
11
21
  end
12
22
  end
@@ -0,0 +1,18 @@
1
+ module Chiketto
2
+ class AttendeeProfile < Resource
3
+ attr_accessor :first_name,
4
+ :last_name,
5
+ :email,
6
+ :name,
7
+ :prefix,
8
+ :suffix,
9
+ :age,
10
+ :job_title,
11
+ :company,
12
+ :website,
13
+ :blog,
14
+ :gender,
15
+ :birth_date,
16
+ :cell_phone
17
+ end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module Chiketto
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -0,0 +1,21 @@
1
+ require 'test_helper'
2
+
3
+ class AttendeeProfileTest < MiniTest::Test
4
+ def test_exposes_data
5
+ attendee_profile = Chiketto::AttendeeProfile.new
6
+ assert_respond_to attendee_profile, :first_name
7
+ assert_respond_to attendee_profile, :last_name
8
+ assert_respond_to attendee_profile, :email
9
+ assert_respond_to attendee_profile, :name
10
+ assert_respond_to attendee_profile, :prefix
11
+ assert_respond_to attendee_profile, :suffix
12
+ assert_respond_to attendee_profile, :age
13
+ assert_respond_to attendee_profile, :job_title
14
+ assert_respond_to attendee_profile, :company
15
+ assert_respond_to attendee_profile, :website
16
+ assert_respond_to attendee_profile, :blog
17
+ assert_respond_to attendee_profile, :gender
18
+ assert_respond_to attendee_profile, :birth_date
19
+ assert_respond_to attendee_profile, :cell_phone
20
+ end
21
+ end
@@ -3,12 +3,13 @@ require 'test_helper'
3
3
  class AttendeeTest < MiniTest::Test
4
4
  def test_exposes_data
5
5
  attendee = Chiketto::Attendee.new
6
- assert_respond_to attendee, :id
7
- assert_respond_to attendee, :email
6
+ assert_respond_to attendee, :ticket_class_id
8
7
  assert_respond_to attendee, :quantity
9
8
  assert_respond_to attendee, :status
10
- assert_respond_to attendee, :ticket_id
11
- assert_respond_to attendee, :answers
9
+ assert_respond_to attendee, :profile
10
+ assert_respond_to attendee, :event_id
11
+ assert_respond_to attendee, :order_id
12
+ assert_respond_to attendee, :addresses
12
13
  end
13
14
 
14
15
  def test_attr_date_types
@@ -17,4 +18,15 @@ class AttendeeTest < MiniTest::Test
17
18
  assert_kind_of DateTime, attendee.created
18
19
  assert_kind_of DateTime, attendee.changed
19
20
  end
21
+
22
+ def test_attendee_returns_profile
23
+ attendee = Chiketto::Attendee.new
24
+ assert_kind_of Chiketto::AttendeeProfile, attendee.profile
25
+ end
26
+
27
+ def test_addresses_returns_an_addresses_array
28
+ attendee = Chiketto::Attendee.new addresses: { home: {} }
29
+ assert_kind_of Hash, attendee.addresses
30
+ assert_kind_of Chiketto::Address, attendee.addresses.values.first
31
+ end
20
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chiketto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Radford
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-07 00:00:00.000000000 Z
11
+ date: 2014-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -111,6 +111,7 @@ files:
111
111
  - lib/chiketto.rb
112
112
  - lib/chiketto/address.rb
113
113
  - lib/chiketto/attendee.rb
114
+ - lib/chiketto/attendee_profile.rb
114
115
  - lib/chiketto/attr_attribute.rb
115
116
  - lib/chiketto/attribute.rb
116
117
  - lib/chiketto/category.rb
@@ -124,6 +125,7 @@ files:
124
125
  - lib/chiketto/version.rb
125
126
  - lib/hash_ext.rb
126
127
  - test/address_test.rb
128
+ - test/attendee_profile_test.rb
127
129
  - test/attendee_test.rb
128
130
  - test/attribute_test.rb
129
131
  - test/category_test.rb
@@ -161,6 +163,7 @@ specification_version: 4
161
163
  summary: Chiketto is a ruby gem for interacting with the Eventbrite V3 API
162
164
  test_files:
163
165
  - test/address_test.rb
166
+ - test/attendee_profile_test.rb
164
167
  - test/attendee_test.rb
165
168
  - test/attribute_test.rb
166
169
  - test/category_test.rb