amiando 0.4.2 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +2 -2
- data/amiando.gemspec +1 -1
- data/lib/amiando.rb +2 -0
- data/lib/amiando/attributes.rb +100 -0
- data/lib/amiando/resource.rb +3 -90
- data/lib/amiando/sync.rb +70 -0
- data/lib/amiando/version.rb +1 -1
- data/test/amiando/sync_test.rb +34 -0
- data/test/fixtures/Sync/dd9a6d959be52283d500af948c787f16.yml +61 -0
- metadata +24 -18
data/Gemfile
CHANGED
@@ -4,12 +4,12 @@ source "http://rubygems.org"
|
|
4
4
|
gemspec
|
5
5
|
|
6
6
|
unless ENV["TRAVIS"]
|
7
|
-
gem '
|
7
|
+
gem 'debugger', :platforms => :ruby_19
|
8
8
|
gem 'ruby-debug', :platforms => :mri_18
|
9
9
|
end
|
10
10
|
|
11
11
|
group :development do
|
12
|
-
gem 'minitest-reporters'
|
12
|
+
gem 'minitest-reporters', '= 0.8.0'
|
13
13
|
gem 'guard-minitest'
|
14
14
|
if RbConfig::CONFIG['target_os'] =~ /darwin/i
|
15
15
|
gem 'rb-fsevent', '>= 0.4.0', :require => false
|
data/amiando.gemspec
CHANGED
@@ -20,8 +20,8 @@ Gem::Specification.new do |s|
|
|
20
20
|
|
21
21
|
s.add_dependency 'typhoeus'
|
22
22
|
s.add_dependency 'multi_json'
|
23
|
-
s.add_dependency 'hydra_cache'
|
24
23
|
|
24
|
+
s.add_development_dependency 'hydra_cache'
|
25
25
|
s.add_development_dependency 'minitest', '2.9.0'
|
26
26
|
s.add_development_dependency 'webmock', '~> 1.7.9'
|
27
27
|
s.add_development_dependency 'rake'
|
data/lib/amiando.rb
CHANGED
@@ -10,6 +10,7 @@ module Amiando
|
|
10
10
|
autoload :Result, 'amiando/result'
|
11
11
|
autoload :Autorun, 'amiando/autorun'
|
12
12
|
autoload :Utils, 'amiando/utils'
|
13
|
+
autoload :Attributes, 'amiando/attributes'
|
13
14
|
|
14
15
|
autoload :ApiKey, 'amiando/api_key'
|
15
16
|
autoload :User, 'amiando/user'
|
@@ -19,6 +20,7 @@ module Amiando
|
|
19
20
|
autoload :TicketShop, 'amiando/ticket_shop'
|
20
21
|
autoload :PaymentType, 'amiando/payment_type'
|
21
22
|
autoload :TicketType, 'amiando/ticket_type'
|
23
|
+
autoload :Sync, 'amiando/sync'
|
22
24
|
|
23
25
|
module Public
|
24
26
|
autoload :Event, 'amiando/public/event'
|
@@ -0,0 +1,100 @@
|
|
1
|
+
module Amiando
|
2
|
+
module Attributes
|
3
|
+
def self.included(base)
|
4
|
+
base.class_eval do
|
5
|
+
attr_reader :attributes
|
6
|
+
extend ClassMethods
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
module ClassMethods
|
11
|
+
def map(local, remote, options = {})
|
12
|
+
mapping[local] = remote
|
13
|
+
typecasting[local] = options[:type] if options[:type]
|
14
|
+
end
|
15
|
+
|
16
|
+
def typecasting
|
17
|
+
@typecasting ||= {}
|
18
|
+
end
|
19
|
+
|
20
|
+
def mapping
|
21
|
+
@mapping ||= {}
|
22
|
+
end
|
23
|
+
|
24
|
+
##
|
25
|
+
# From { :first_name => '1', :last_name => '2' }
|
26
|
+
# to { :firstName => '1', :lastName => '2' }
|
27
|
+
def map_params(attributes)
|
28
|
+
mapped_attributes = attributes.map do |key,value|
|
29
|
+
mapped_key = mapping[key] || Utils.camelize(key, :lower).to_sym
|
30
|
+
value = typecast(key, value)
|
31
|
+
[mapped_key, value]
|
32
|
+
end
|
33
|
+
Hash[mapped_attributes]
|
34
|
+
end
|
35
|
+
|
36
|
+
def reverse_map_params(attributes)
|
37
|
+
inverted_mapping = mapping.invert
|
38
|
+
mapped_attributes = attributes.map do |key,value|
|
39
|
+
key = key.to_sym
|
40
|
+
mapped_key = inverted_mapping[key] || Utils.underscore(key).to_sym
|
41
|
+
value = inverse_typecast(mapped_key, value)
|
42
|
+
[mapped_key, value]
|
43
|
+
end
|
44
|
+
Hash[mapped_attributes]
|
45
|
+
end
|
46
|
+
|
47
|
+
def typecast(key, value)
|
48
|
+
if typecasting[key] == :time || value.is_a?(Time)
|
49
|
+
value.iso8601
|
50
|
+
else
|
51
|
+
value
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def inverse_typecast(key, value)
|
56
|
+
if typecasting[key] == :time
|
57
|
+
Time.parse(value)
|
58
|
+
else
|
59
|
+
value
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def id
|
65
|
+
attributes[:id]
|
66
|
+
end
|
67
|
+
|
68
|
+
def type
|
69
|
+
attributes[:type]
|
70
|
+
end
|
71
|
+
|
72
|
+
def [](key)
|
73
|
+
@attributes[key.to_sym]
|
74
|
+
end
|
75
|
+
|
76
|
+
def respond_to?(method_name, include_private = false)
|
77
|
+
super || attributes.key?(method_name)
|
78
|
+
end
|
79
|
+
|
80
|
+
def method_missing(method_name, *args, &block)
|
81
|
+
if attributes.key?(method_name) && args.empty?
|
82
|
+
attributes[method_name]
|
83
|
+
else
|
84
|
+
super
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
protected
|
89
|
+
|
90
|
+
def set_attributes(attributes)
|
91
|
+
if attributes
|
92
|
+
@attributes = {}
|
93
|
+
|
94
|
+
self.class.reverse_map_params(attributes).each do |k,v|
|
95
|
+
@attributes[k.to_sym] = v
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
data/lib/amiando/resource.rb
CHANGED
@@ -1,49 +1,14 @@
|
|
1
1
|
module Amiando
|
2
2
|
class Resource
|
3
|
-
include
|
3
|
+
include Autorun
|
4
|
+
include Attributes
|
4
5
|
|
5
6
|
attr_accessor :request, :response
|
6
|
-
attr_reader :success
|
7
|
+
attr_reader :success
|
7
8
|
|
8
9
|
autorun :request, :response, :success, :attributes
|
9
10
|
|
10
11
|
class << self
|
11
|
-
def map(local, remote, options = {})
|
12
|
-
mapping[local] = remote
|
13
|
-
typecasting[local] = options[:type] if options[:type]
|
14
|
-
end
|
15
|
-
|
16
|
-
def typecasting
|
17
|
-
@typecasting ||= {}
|
18
|
-
end
|
19
|
-
|
20
|
-
def mapping
|
21
|
-
@mapping ||= {}
|
22
|
-
end
|
23
|
-
|
24
|
-
##
|
25
|
-
# From { :first_name => '1', :last_name => '2' }
|
26
|
-
# to { :firstName => '1', :lastName => '2' }
|
27
|
-
def map_params(attributes)
|
28
|
-
mapped_attributes = attributes.map do |key,value|
|
29
|
-
mapped_key = mapping[key] || Utils.camelize(key, :lower).to_sym
|
30
|
-
value = typecast(key, value)
|
31
|
-
[mapped_key, value]
|
32
|
-
end
|
33
|
-
Hash[mapped_attributes]
|
34
|
-
end
|
35
|
-
|
36
|
-
def reverse_map_params(attributes)
|
37
|
-
inverted_mapping = mapping.invert
|
38
|
-
mapped_attributes = attributes.map do |key,value|
|
39
|
-
key = key.to_sym
|
40
|
-
mapped_key = inverted_mapping[key] || Utils.underscore(key).to_sym
|
41
|
-
value = inverse_typecast(mapped_key, value)
|
42
|
-
[mapped_key, value]
|
43
|
-
end
|
44
|
-
Hash[mapped_attributes]
|
45
|
-
end
|
46
|
-
|
47
12
|
def method_missing(method_name, *args, &block)
|
48
13
|
if match = /sync_(.*)/.match(method_name.to_s)
|
49
14
|
res = self.send(match[1], *args, &block)
|
@@ -101,52 +66,12 @@ module Amiando
|
|
101
66
|
def post(object, path, options = {})
|
102
67
|
do_request(object, :post, path, options)
|
103
68
|
end
|
104
|
-
|
105
|
-
def typecast(key, value)
|
106
|
-
if typecasting[key] == :time || value.is_a?(Time)
|
107
|
-
value.iso8601
|
108
|
-
else
|
109
|
-
value
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
def inverse_typecast(key, value)
|
114
|
-
if typecasting[key] == :time
|
115
|
-
Time.parse(value)
|
116
|
-
else
|
117
|
-
value
|
118
|
-
end
|
119
|
-
end
|
120
69
|
end
|
121
70
|
|
122
71
|
def initialize(attributes = nil)
|
123
72
|
set_attributes(attributes)
|
124
73
|
end
|
125
74
|
|
126
|
-
def [](key)
|
127
|
-
@attributes[key.to_sym]
|
128
|
-
end
|
129
|
-
|
130
|
-
def respond_to?(method_name, include_private = false)
|
131
|
-
super || attributes.key?(method_name)
|
132
|
-
end
|
133
|
-
|
134
|
-
def method_missing(method_name, *args, &block)
|
135
|
-
if attributes.key?(method_name) && args.empty?
|
136
|
-
attributes[method_name]
|
137
|
-
else
|
138
|
-
super
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
def id
|
143
|
-
attributes[:id]
|
144
|
-
end
|
145
|
-
|
146
|
-
def type
|
147
|
-
attributes[:type]
|
148
|
-
end
|
149
|
-
|
150
75
|
def populate(reponse_body)
|
151
76
|
raise Error::NotImplemented.new("populate method not implemented for #{self.class}")
|
152
77
|
end
|
@@ -167,17 +92,5 @@ module Amiando
|
|
167
92
|
def ==(resource)
|
168
93
|
id == resource.id
|
169
94
|
end
|
170
|
-
|
171
|
-
protected
|
172
|
-
|
173
|
-
def set_attributes(attributes)
|
174
|
-
if attributes
|
175
|
-
@attributes = {}
|
176
|
-
|
177
|
-
self.class.reverse_map_params(attributes).each do |k,v|
|
178
|
-
@attributes[k.to_sym] = v
|
179
|
-
end
|
180
|
-
end
|
181
|
-
end
|
182
95
|
end
|
183
96
|
end
|
data/lib/amiando/sync.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
module Amiando
|
2
|
+
|
3
|
+
##
|
4
|
+
# The main attributes are events and next_id.
|
5
|
+
#
|
6
|
+
# Read through [Amiando::Sync::Event] to know how to understand the
|
7
|
+
# information returned.
|
8
|
+
class Sync < Resource
|
9
|
+
attr_accessor :events, :next_id
|
10
|
+
|
11
|
+
def initialize(events, next_id)
|
12
|
+
@events, @next_id = events, next_id
|
13
|
+
end
|
14
|
+
|
15
|
+
##
|
16
|
+
# Get the latest 'synchronization' events. Let's not forget that in this
|
17
|
+
# case an 'event' is something that happened. It could be, for instance,
|
18
|
+
# that a new ticket was bought, that an event was modified, or similar.
|
19
|
+
#
|
20
|
+
# Read the http://developers.amiando.com/index.php/REST_API_DataSync docs
|
21
|
+
# to find out how it really works. Simplifying, you find by the latest id
|
22
|
+
# you have, and go through the events returned.
|
23
|
+
#
|
24
|
+
# When you find a data synchronization you get everything that happened
|
25
|
+
# (events) and the next id you should query for. Next time you should use
|
26
|
+
# that id when calling this method.
|
27
|
+
#
|
28
|
+
# @param last_id
|
29
|
+
#
|
30
|
+
# @return [Amiando::Sync] with all the [Amiando::Sync::Event]
|
31
|
+
#
|
32
|
+
def self.find(last_id)
|
33
|
+
object = Result.new do |response_body, result|
|
34
|
+
if response_body["success"]
|
35
|
+
events = response_body['events'].map do |event|
|
36
|
+
Sync::Event.new(event)
|
37
|
+
end
|
38
|
+
Sync.new(events, response_body['nextId'])
|
39
|
+
else
|
40
|
+
result.errors = response_body['errors']
|
41
|
+
false
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
get object, "api/sync/#{last_id}"
|
46
|
+
|
47
|
+
object
|
48
|
+
end
|
49
|
+
|
50
|
+
##
|
51
|
+
# A synchronization event aka 'Something that happened'.
|
52
|
+
#
|
53
|
+
# You should use mainly 4 attributes:
|
54
|
+
#
|
55
|
+
# * object_type and returned_object_type will allow you to know what kind
|
56
|
+
# of object you should be dealing with. Read through the official docs
|
57
|
+
# to know the difference between them.
|
58
|
+
# * object_id is the id of whichever object you're dealing with.
|
59
|
+
# * operation is what happened to that object. Typically 'create', 'delete'
|
60
|
+
# and 'update'. But beware the 'resync' one.
|
61
|
+
#
|
62
|
+
class Event
|
63
|
+
include Attributes
|
64
|
+
|
65
|
+
def initialize(hash)
|
66
|
+
set_attributes(hash)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/lib/amiando/version.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
describe Amiando::Sync do
|
4
|
+
before do
|
5
|
+
HydraCache.prefix = 'Sync'
|
6
|
+
end
|
7
|
+
|
8
|
+
after do
|
9
|
+
HydraCache.prefix = nil
|
10
|
+
end
|
11
|
+
|
12
|
+
describe 'find' do
|
13
|
+
it 'gets the next synchronization events' do
|
14
|
+
sync = Amiando::Sync.find(0)
|
15
|
+
Amiando.run
|
16
|
+
|
17
|
+
sync.result.must_be_instance_of Amiando::Sync
|
18
|
+
sync.result.events.must_be_instance_of Array
|
19
|
+
sync.result.next_id.must_be :>, 0
|
20
|
+
|
21
|
+
sync_event = sync.result.events.first
|
22
|
+
sync_event.must_be_instance_of Amiando::Sync::Event
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe Amiando::Sync::Event do
|
27
|
+
it 'simply converts the given attributes' do
|
28
|
+
sync_event = Amiando::Sync::Event.new(:id => 1, :path => '/some/thing')
|
29
|
+
|
30
|
+
sync_event.id.must_equal 1
|
31
|
+
sync_event.path.must_equal '/some/thing'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
--- !ruby/object:Typhoeus::Response
|
2
|
+
app_connect_time: 0.383558
|
3
|
+
body: "{\"events\":[{\"id\":8031381,\"operation\":\"create\",\"objectId\":256615765,\"returnedObjectType\":\"user\",\"path\":\"/api/user/256615765\",\"objectType\":\"user\"},{\"id\":8031382,\"operation\":\"create\",\"objectId\":483205,\"returnedObjectType\":\"event\",\"path\":\"/api/event/483205\",\"objectType\":\"event\"},{\"id\":8031383,\"operation\":\"create\",\"objectId\":483205,\"returnedObjectType\":\"event\",\"path\":\"/api/event/483205\",\"objectType\":\"event\"},{\"id\":8031384,\"operation\":\"create\",\"objectId\":483205,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483205/ticketShop\",\"objectType\":\"event\"},{\"id\":8031385,\"operation\":\"create\",\"objectId\":483205,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483205/ticketShop\",\"objectType\":\"event\"},{\"id\":8031386,\"operation\":\"update\",\"objectId\":483205,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483205/ticketShop\",\"objectType\":\"event\"},{\"id\":8031387,\"operation\":\"update\",\"objectId\":483205,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483205/ticketShop\",\"objectType\":\"event\"},{\"id\":8031388,\"operation\":\"update\",\"objectId\":483205,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483205/ticketShop\",\"objectType\":\"event\"},{\"id\":8031389,\"operation\":\"update\",\"objectId\":483205,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483205/ticketShop\",\"objectType\":\"event\"},{\"id\":8031390,\"operation\":\"update\",\"objectId\":483205,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483205/ticketShop\",\"objectType\":\"event\"},{\"id\":8031391,\"operation\":\"update\",\"objectId\":483205,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483205/ticketShop\",\"objectType\":\"event\"},{\"id\":8031392,\"operation\":\"update\",\"objectId\":483205,\"returnedObjectType\":\"event\",\"path\":\"/api/event/483205\",\"objectType\":\"event\"},{\"id\":8031393,\"operation\":\"update\",\"objectId\":483205,\"returnedObjectType\":\"event\",\"path\":\"/api/event/483205\",\"objectType\":\"event\"},{\"id\":8031394,\"operation\":\"create\",\"objectId\":483206,\"returnedObjectType\":\"event\",\"path\":\"/api/event/483206\",\"objectType\":\"event\"},{\"id\":8031395,\"operation\":\"create\",\"objectId\":483206,\"returnedObjectType\":\"event\",\"path\":\"/api/event/483206\",\"objectType\":\"event\"},{\"id\":8031396,\"operation\":\"create\",\"objectId\":483206,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483206/ticketShop\",\"objectType\":\"event\"},{\"id\":8031397,\"operation\":\"create\",\"objectId\":483206,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483206/ticketShop\",\"objectType\":\"event\"},{\"id\":8031398,\"operation\":\"update\",\"objectId\":483206,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483206/ticketShop\",\"objectType\":\"event\"},{\"id\":8031399,\"operation\":\"update\",\"objectId\":483206,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483206/ticketShop\",\"objectType\":\"event\"},{\"id\":8031400,\"operation\":\"update\",\"objectId\":483206,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483206/ticketShop\",\"objectType\":\"event\"},{\"id\":8031401,\"operation\":\"update\",\"objectId\":483206,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483206/ticketShop\",\"objectType\":\"event\"},{\"id\":8031402,\"operation\":\"update\",\"objectId\":483206,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483206/ticketShop\",\"objectType\":\"event\"},{\"id\":8031403,\"operation\":\"update\",\"objectId\":483206,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483206/ticketShop\",\"objectType\":\"event\"},{\"id\":8031404,\"operation\":\"update\",\"objectId\":483206,\"returnedObjectType\":\"event\",\"path\":\"/api/event/483206\",\"objectType\":\"event\"},{\"id\":8031405,\"operation\":\"update\",\"objectId\":483206,\"returnedObjectType\":\"event\",\"path\":\"/api/event/483206\",\"objectType\":\"event\"},{\"id\":8031406,\"operation\":\"create\",\"objectId\":483207,\"returnedObjectType\":\"event\",\"path\":\"/api/event/483207\",\"objectType\":\"event\"},{\"id\":8031407,\"operation\":\"create\",\"objectId\":483207,\"returnedObjectType\":\"event\",\"path\":\"/api/event/483207\",\"objectType\":\"event\"},{\"id\":8031408,\"operation\":\"create\",\"objectId\":483207,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483207/ticketShop\",\"objectType\":\"event\"},{\"id\":8031409,\"operation\":\"create\",\"objectId\":483207,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483207/ticketShop\",\"objectType\":\"event\"},{\"id\":8031410,\"operation\":\"update\",\"objectId\":483207,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483207/ticketShop\",\"objectType\":\"event\"},{\"id\":8031411,\"operation\":\"update\",\"objectId\":483207,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483207/ticketShop\",\"objectType\":\"event\"},{\"id\":8031412,\"operation\":\"update\",\"objectId\":483207,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483207/ticketShop\",\"objectType\":\"event\"},{\"id\":8031413,\"operation\":\"update\",\"objectId\":483207,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483207/ticketShop\",\"objectType\":\"event\"},{\"id\":8031414,\"operation\":\"update\",\"objectId\":483207,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483207/ticketShop\",\"objectType\":\"event\"},{\"id\":8031415,\"operation\":\"update\",\"objectId\":483207,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483207/ticketShop\",\"objectType\":\"event\"},{\"id\":8031416,\"operation\":\"update\",\"objectId\":483207,\"returnedObjectType\":\"event\",\"path\":\"/api/event/483207\",\"objectType\":\"event\"},{\"id\":8031417,\"operation\":\"update\",\"objectId\":483207,\"returnedObjectType\":\"event\",\"path\":\"/api/event/483207\",\"objectType\":\"event\"},{\"id\":8031418,\"operation\":\"delete\",\"objectId\":483207,\"returnedObjectType\":\"event\",\"path\":\"/api/event/483207\",\"objectType\":\"event\"},{\"id\":8031419,\"operation\":\"create\",\"objectId\":483208,\"returnedObjectType\":\"event\",\"path\":\"/api/event/483208\",\"objectType\":\"event\"},{\"id\":8031420,\"operation\":\"create\",\"objectId\":483208,\"returnedObjectType\":\"event\",\"path\":\"/api/event/483208\",\"objectType\":\"event\"},{\"id\":8031421,\"operation\":\"create\",\"objectId\":483208,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483208/ticketShop\",\"objectType\":\"event\"},{\"id\":8031422,\"operation\":\"create\",\"objectId\":483208,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483208/ticketShop\",\"objectType\":\"event\"},{\"id\":8031423,\"operation\":\"update\",\"objectId\":483208,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483208/ticketShop\",\"objectType\":\"event\"},{\"id\":8031424,\"operation\":\"update\",\"objectId\":483208,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483208/ticketShop\",\"objectType\":\"event\"},{\"id\":8031425,\"operation\":\"update\",\"objectId\":483208,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483208/ticketShop\",\"objectType\":\"event\"},{\"id\":8031426,\"operation\":\"update\",\"objectId\":483208,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483208/ticketShop\",\"objectType\":\"event\"},{\"id\":8031427,\"operation\":\"update\",\"objectId\":483208,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483208/ticketShop\",\"objectType\":\"event\"},{\"id\":8031428,\"operation\":\"update\",\"objectId\":483208,\"returnedObjectType\":\"ticketShop\",\"path\":\"/api/event/483208/ticketShop\",\"objectType\":\"event\"},{\"id\":8031429,\"operation\":\"update\",\"objectId\":483208,\"returnedObjectType\":\"event\",\"path\":\"/api/event/483208\",\"objectType\":\"event\"},{\"id\":8031430,\"operation\":\"update\",\"objectId\":483208,\"returnedObjectType\":\"event\",\"path\":\"/api/event/483208\",\"objectType\":\"event\"}],\"nextId\":8031431,\"success\":true}"
|
4
|
+
code: 200
|
5
|
+
connect_time: 0.140169
|
6
|
+
curl_error_message: No error
|
7
|
+
curl_return_code: 0
|
8
|
+
effective_url: https://test.amiando.com/api/sync/0?apikey=qjphdq7wWaGQRfjA2xmZAyekT9iehhS75q8DVhrMLsYaYTXlOE&format=json&version=1
|
9
|
+
first_header_line: HTTP/1.1 200 OK
|
10
|
+
headers: |
|
11
|
+
HTTP/1.1 200 OK
|
12
|
+
Date: Wed, 12 Sep 2012 14:57:10 GMT
|
13
|
+
Server: Apache/2.0.55 (Red Hat)
|
14
|
+
Set-Cookie: JSESSIONID=5488AA8FFD1619C6DB3B23262D5E5281.amiando; Path=/; Secure; HttpOnly
|
15
|
+
Set-Cookie: JSESSIONID=5488AA8FFD1619C6DB3B23262D5E5281.amiando; Path=/
|
16
|
+
accept-charset: utf-8
|
17
|
+
P3P: policyref="/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD CON OUR IND UNI PUR COM CNT"
|
18
|
+
Access-Control-Allow-Origin: *
|
19
|
+
Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUT
|
20
|
+
Set-Cookie: ANONYMOUS_HASHED_REMEMBER_ME_COOKIE_KEY=a0RvUmtkNVNObkdiVkJMYjoxMzQ4NjcxOTE1ODgzOmZmYzA4MDg4ZWY2ZGE1MzIyZGI4NDI3MTc0YTM5Mzcw; Expires=Mon, 11-Sep-2017 15:05:15 GMT; Path=/
|
21
|
+
Vary: Accept-Charset,Accept-Encoding,Accept-Language,Accept,User-Agent
|
22
|
+
Accept-Ranges: bytes
|
23
|
+
Cache-Control: max-age=7200
|
24
|
+
Expires: Wed, 12 Sep 2012 16:57:10 GMT
|
25
|
+
Transfer-Encoding: chunked
|
26
|
+
Content-Type: application/json;charset=UTF-8
|
27
|
+
|
28
|
+
|
29
|
+
headers_hash: !map:Typhoeus::Header
|
30
|
+
Cache-Control: max-age=7200
|
31
|
+
Accept-Charset: utf-8
|
32
|
+
Transfer-Encoding: chunked
|
33
|
+
Expires: Wed, 12 Sep 2012 16:57:10 GMT
|
34
|
+
Set-Cookie:
|
35
|
+
- JSESSIONID=5488AA8FFD1619C6DB3B23262D5E5281.amiando; Path=/; Secure; HttpOnly
|
36
|
+
- JSESSIONID=5488AA8FFD1619C6DB3B23262D5E5281.amiando; Path=/
|
37
|
+
- ANONYMOUS_HASHED_REMEMBER_ME_COOKIE_KEY=a0RvUmtkNVNObkdiVkJMYjoxMzQ4NjcxOTE1ODgzOmZmYzA4MDg4ZWY2ZGE1MzIyZGI4NDI3MTc0YTM5Mzcw; Expires=Mon, 11-Sep-2017 15:05:15 GMT; Path=/
|
38
|
+
Server: Apache/2.0.55 (Red Hat)
|
39
|
+
P3p: policyref="/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD CON OUR IND UNI PUR COM CNT"
|
40
|
+
Accept-Ranges: bytes
|
41
|
+
Access-Control-Allow-Origin: "*"
|
42
|
+
Date: Wed, 12 Sep 2012 14:57:10 GMT
|
43
|
+
Content-Type: application/json;charset=UTF-8
|
44
|
+
Vary: Accept-Charset,Accept-Encoding,Accept-Language,Accept,User-Agent
|
45
|
+
Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUT
|
46
|
+
http_version:
|
47
|
+
mock: false
|
48
|
+
name_lookup_time: 0.086982
|
49
|
+
pretransfer_time: 0.38356
|
50
|
+
primary_ip: 213.61.176.214
|
51
|
+
redirect_count: 0
|
52
|
+
request: |-
|
53
|
+
:method => :get,
|
54
|
+
:url => https://test.amiando.com/api/sync/0?apikey=qjphdq7wWaGQRfjA2xmZAyekT9iehhS75q8DVhrMLsYaYTXlOE&format=json&version=1,
|
55
|
+
:params => {:version=>1, :format=>:json, :apikey=>"qjphdq7wWaGQRfjA2xmZAyekT9iehhS75q8DVhrMLsYaYTXlOE"}
|
56
|
+
requested_http_method:
|
57
|
+
requested_url:
|
58
|
+
start_time:
|
59
|
+
start_transfer_time: 0.705229
|
60
|
+
status_message: OK
|
61
|
+
time: 0.705746
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amiando
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 3
|
10
|
+
version: 0.4.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jorge Dias
|
@@ -16,10 +16,9 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2012-
|
19
|
+
date: 2012-09-12 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
prerelease: false
|
23
22
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
23
|
none: false
|
25
24
|
requirements:
|
@@ -29,11 +28,11 @@ dependencies:
|
|
29
28
|
segments:
|
30
29
|
- 0
|
31
30
|
version: "0"
|
32
|
-
name: typhoeus
|
33
31
|
version_requirements: *id001
|
32
|
+
prerelease: false
|
34
33
|
type: :runtime
|
34
|
+
name: typhoeus
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
|
-
prerelease: false
|
37
36
|
requirement: &id002 !ruby/object:Gem::Requirement
|
38
37
|
none: false
|
39
38
|
requirements:
|
@@ -43,11 +42,11 @@ dependencies:
|
|
43
42
|
segments:
|
44
43
|
- 0
|
45
44
|
version: "0"
|
46
|
-
name: multi_json
|
47
45
|
version_requirements: *id002
|
46
|
+
prerelease: false
|
48
47
|
type: :runtime
|
48
|
+
name: multi_json
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
|
-
prerelease: false
|
51
50
|
requirement: &id003 !ruby/object:Gem::Requirement
|
52
51
|
none: false
|
53
52
|
requirements:
|
@@ -57,11 +56,11 @@ dependencies:
|
|
57
56
|
segments:
|
58
57
|
- 0
|
59
58
|
version: "0"
|
60
|
-
name: hydra_cache
|
61
59
|
version_requirements: *id003
|
62
|
-
type: :runtime
|
63
|
-
- !ruby/object:Gem::Dependency
|
64
60
|
prerelease: false
|
61
|
+
type: :development
|
62
|
+
name: hydra_cache
|
63
|
+
- !ruby/object:Gem::Dependency
|
65
64
|
requirement: &id004 !ruby/object:Gem::Requirement
|
66
65
|
none: false
|
67
66
|
requirements:
|
@@ -73,11 +72,11 @@ dependencies:
|
|
73
72
|
- 9
|
74
73
|
- 0
|
75
74
|
version: 2.9.0
|
76
|
-
name: minitest
|
77
75
|
version_requirements: *id004
|
76
|
+
prerelease: false
|
78
77
|
type: :development
|
78
|
+
name: minitest
|
79
79
|
- !ruby/object:Gem::Dependency
|
80
|
-
prerelease: false
|
81
80
|
requirement: &id005 !ruby/object:Gem::Requirement
|
82
81
|
none: false
|
83
82
|
requirements:
|
@@ -89,11 +88,11 @@ dependencies:
|
|
89
88
|
- 7
|
90
89
|
- 9
|
91
90
|
version: 1.7.9
|
92
|
-
name: webmock
|
93
91
|
version_requirements: *id005
|
92
|
+
prerelease: false
|
94
93
|
type: :development
|
94
|
+
name: webmock
|
95
95
|
- !ruby/object:Gem::Dependency
|
96
|
-
prerelease: false
|
97
96
|
requirement: &id006 !ruby/object:Gem::Requirement
|
98
97
|
none: false
|
99
98
|
requirements:
|
@@ -103,9 +102,10 @@ dependencies:
|
|
103
102
|
segments:
|
104
103
|
- 0
|
105
104
|
version: "0"
|
106
|
-
name: rake
|
107
105
|
version_requirements: *id006
|
106
|
+
prerelease: false
|
108
107
|
type: :development
|
108
|
+
name: rake
|
109
109
|
description: A ruby client for the amiando REST API with parallel requests in mind
|
110
110
|
email:
|
111
111
|
- jorge@mrdias.com
|
@@ -128,6 +128,7 @@ files:
|
|
128
128
|
- amiando.gemspec
|
129
129
|
- lib/amiando.rb
|
130
130
|
- lib/amiando/api_key.rb
|
131
|
+
- lib/amiando/attributes.rb
|
131
132
|
- lib/amiando/autorun.rb
|
132
133
|
- lib/amiando/boolean.rb
|
133
134
|
- lib/amiando/event.rb
|
@@ -137,6 +138,7 @@ files:
|
|
137
138
|
- lib/amiando/request.rb
|
138
139
|
- lib/amiando/resource.rb
|
139
140
|
- lib/amiando/result.rb
|
141
|
+
- lib/amiando/sync.rb
|
140
142
|
- lib/amiando/ticket_category.rb
|
141
143
|
- lib/amiando/ticket_shop.rb
|
142
144
|
- lib/amiando/ticket_type.rb
|
@@ -152,6 +154,7 @@ files:
|
|
152
154
|
- test/amiando/public/event_test.rb
|
153
155
|
- test/amiando/resource_test.rb
|
154
156
|
- test/amiando/result_test.rb
|
157
|
+
- test/amiando/sync_test.rb
|
155
158
|
- test/amiando/ticket_category_test.rb
|
156
159
|
- test/amiando/ticket_shop_test.rb
|
157
160
|
- test/amiando/ticket_type_test.rb
|
@@ -205,6 +208,7 @@ files:
|
|
205
208
|
- test/fixtures/Public_Event/2e1010c291a198649de6d1f90400915d.yml
|
206
209
|
- test/fixtures/Public_Event/69579623e3daf114388eca9a092888d2.yml
|
207
210
|
- test/fixtures/Public_Event/c17ae073926cbf435dbb1f75ffc12958.yml
|
211
|
+
- test/fixtures/Sync/dd9a6d959be52283d500af948c787f16.yml
|
208
212
|
- test/fixtures/TicketCategory/005fd9f0880b67573d3c8079055eb643.yml
|
209
213
|
- test/fixtures/TicketCategory/380dab86840ec5d2b7c564c10b229d36.yml
|
210
214
|
- test/fixtures/TicketCategory/be3cac510d8e7aae8bcbb4310cb1b460.yml
|
@@ -276,7 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
276
280
|
requirements: []
|
277
281
|
|
278
282
|
rubyforge_project: amiando
|
279
|
-
rubygems_version: 1.8.
|
283
|
+
rubygems_version: 1.8.24
|
280
284
|
signing_key:
|
281
285
|
specification_version: 3
|
282
286
|
summary: A ruby client for the amiando REST API
|
@@ -290,6 +294,7 @@ test_files:
|
|
290
294
|
- test/amiando/public/event_test.rb
|
291
295
|
- test/amiando/resource_test.rb
|
292
296
|
- test/amiando/result_test.rb
|
297
|
+
- test/amiando/sync_test.rb
|
293
298
|
- test/amiando/ticket_category_test.rb
|
294
299
|
- test/amiando/ticket_shop_test.rb
|
295
300
|
- test/amiando/ticket_type_test.rb
|
@@ -343,6 +348,7 @@ test_files:
|
|
343
348
|
- test/fixtures/Public_Event/2e1010c291a198649de6d1f90400915d.yml
|
344
349
|
- test/fixtures/Public_Event/69579623e3daf114388eca9a092888d2.yml
|
345
350
|
- test/fixtures/Public_Event/c17ae073926cbf435dbb1f75ffc12958.yml
|
351
|
+
- test/fixtures/Sync/dd9a6d959be52283d500af948c787f16.yml
|
346
352
|
- test/fixtures/TicketCategory/005fd9f0880b67573d3c8079055eb643.yml
|
347
353
|
- test/fixtures/TicketCategory/380dab86840ec5d2b7c564c10b229d36.yml
|
348
354
|
- test/fixtures/TicketCategory/be3cac510d8e7aae8bcbb4310cb1b460.yml
|