Class: Rapa::Queries::BaseQuery
- Inherits:
-
Object
- Object
- Rapa::Queries::BaseQuery
show all
- Defined in:
- lib/rapa/queries/base_query.rb
Constant Summary
collapse
- SERVICE =
"AWSECommerceService"
- VERSION =
"2013-08-01"
Class Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options = {}) ⇒ BaseQuery
Returns a new instance of BaseQuery.
40
41
42
|
# File 'lib/rapa/queries/base_query.rb', line 40
def initialize(options = {})
@options = options
end
|
Class Attribute Details
.property_names ⇒ Array<Symbol>
19
20
21
|
# File 'lib/rapa/queries/base_query.rb', line 19
def property_names
@property_names ||= []
end
|
Class Method Details
.inherited(child_class) ⇒ Object
14
15
16
|
# File 'lib/rapa/queries/base_query.rb', line 14
def inherited(child_class)
child_class.property_names = property_names.clone
end
|
.property(property_name) ⇒ Object
24
25
26
|
# File 'lib/rapa/queries/base_query.rb', line 24
def property(property_name)
property_names << property_name
end
|
Instance Method Details
#AssociateTag ⇒ String
50
51
52
|
# File 'lib/rapa/queries/base_query.rb', line 50
def AssociateTag
options[:associate_tag]
end
|
#AWSAccessKeyId ⇒ String
55
56
57
|
# File 'lib/rapa/queries/base_query.rb', line 55
def AWSAccessKeyId
options[:access_key_id]
end
|
#inspect ⇒ Object
45
46
47
|
# File 'lib/rapa/queries/base_query.rb', line 45
def inspect
"#<#{self.class}>"
end
|
#Operation ⇒ String
60
61
62
|
# File 'lib/rapa/queries/base_query.rb', line 60
def Operation
raise ::NotImplementedError
end
|
#RelatedItemPage ⇒ Integer?
65
66
67
|
# File 'lib/rapa/queries/base_query.rb', line 65
def RelatedItemPage
options[:related_item_page]
end
|
#RelationshipType ⇒ String?
70
71
72
|
# File 'lib/rapa/queries/base_query.rb', line 70
def RelationshipType
options[:relationship_type]
end
|
#ResponseGroup ⇒ String?
75
76
77
78
79
|
# File 'lib/rapa/queries/base_query.rb', line 75
def ResponseGroup
if options[:response_groups]
options[:response_groups].join(",")
end
end
|
#Service ⇒ String
82
83
84
|
# File 'lib/rapa/queries/base_query.rb', line 82
def Service
SERVICE
end
|
#Timestamp ⇒ String
87
88
89
|
# File 'lib/rapa/queries/base_query.rb', line 87
def Timestamp
::Time.now.utc.iso8601
end
|
#to_hash ⇒ Hash
92
93
94
95
96
97
98
99
|
# File 'lib/rapa/queries/base_query.rb', line 92
def to_hash
self.class.property_names.each_with_object({}) do |property_name, result|
value = send(property_name)
unless value.nil?
result[property_name.to_s] = ::ERB::Util.url_encode(value)
end
end.sort.to_h
end
|
#to_s ⇒ String
102
103
104
105
106
107
108
109
|
# File 'lib/rapa/queries/base_query.rb', line 102
def to_s
to_hash.map do |key, value|
[
key,
value,
].join("=")
end.join("&")
end
|
#Version ⇒ String
112
113
114
|
# File 'lib/rapa/queries/base_query.rb', line 112
def Version
VERSION
end
|