Class: BeyondApi::Session
- Inherits:
-
Object
- Object
- BeyondApi::Session
- Defined in:
- lib/beyond_api/session.rb
Defined Under Namespace
Classes: InvalidUriProtocolError
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#api_url ⇒ Object
readonly
Returns the value of attribute api_url.
-
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
Instance Method Summary collapse
- #carts ⇒ Object
- #categories ⇒ Object
- #categories_view ⇒ Object
- #checkout_settings ⇒ Object
- #customers ⇒ Object
-
#initialize(api_url:, access_token: nil, refresh_token: nil) ⇒ Session
constructor
A new instance of Session.
- #newsletter_target ⇒ Object
- #order_settings ⇒ Object
- #orders ⇒ Object
- #payment_method_definitions ⇒ Object
- #payment_methods ⇒ Object
- #pickup_options ⇒ Object
- #product_attribute_definitions ⇒ Object
- #products ⇒ Object
- #products_view ⇒ Object
- #script_tags ⇒ Object
- #shipping_zones ⇒ Object
- #shop ⇒ Object
- #signers ⇒ Object
- #token ⇒ Object
- #users ⇒ Object
- #variations ⇒ Object
- #webhook_subscriptions ⇒ Object
Constructor Details
#initialize(api_url:, access_token: nil, refresh_token: nil) ⇒ Session
Returns a new instance of Session.
34 35 36 37 38 39 40 41 42 |
# File 'lib/beyond_api/session.rb', line 34 def initialize(api_url:, access_token: nil, refresh_token: nil) raise InvalidUriProtocolError, "Invalid URI protocol" unless api_url.start_with? "https://" uri = URI.parse(api_url) @api_url = "#{uri.scheme}://#{uri.host}/api" @access_token = access_token @refresh_token = refresh_token end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
32 33 34 |
# File 'lib/beyond_api/session.rb', line 32 def access_token @access_token end |
#api_url ⇒ Object (readonly)
Returns the value of attribute api_url.
31 32 33 |
# File 'lib/beyond_api/session.rb', line 31 def api_url @api_url end |
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
32 33 34 |
# File 'lib/beyond_api/session.rb', line 32 def refresh_token @refresh_token end |
Instance Method Details
#carts ⇒ Object
44 45 46 |
# File 'lib/beyond_api/session.rb', line 44 def carts BeyondApi::Carts.new(self) end |
#categories ⇒ Object
52 53 54 |
# File 'lib/beyond_api/session.rb', line 52 def categories BeyondApi::Categories.new(self) end |
#categories_view ⇒ Object
48 49 50 |
# File 'lib/beyond_api/session.rb', line 48 def categories_view BeyondApi::CategoriesView.new(self) end |
#checkout_settings ⇒ Object
56 57 58 |
# File 'lib/beyond_api/session.rb', line 56 def checkout_settings BeyondApi::CheckoutSettings.new(self) end |
#customers ⇒ Object
60 61 62 |
# File 'lib/beyond_api/session.rb', line 60 def customers BeyondApi::Customers.new(self) end |
#newsletter_target ⇒ Object
64 65 66 |
# File 'lib/beyond_api/session.rb', line 64 def BeyondApi::NewsletterTarget.new(self) end |
#order_settings ⇒ Object
68 69 70 |
# File 'lib/beyond_api/session.rb', line 68 def order_settings BeyondApi::OrderSettings.new(self) end |
#orders ⇒ Object
72 73 74 |
# File 'lib/beyond_api/session.rb', line 72 def orders BeyondApi::Orders.new(self) end |
#payment_method_definitions ⇒ Object
76 77 78 |
# File 'lib/beyond_api/session.rb', line 76 def payment_method_definitions BeyondApi::PaymentMethodDefinitions.new(self) end |
#payment_methods ⇒ Object
80 81 82 |
# File 'lib/beyond_api/session.rb', line 80 def payment_methods BeyondApi::PaymentMethods.new(self) end |
#pickup_options ⇒ Object
84 85 86 |
# File 'lib/beyond_api/session.rb', line 84 def BeyondApi::PickupOptions.new(self) end |
#product_attribute_definitions ⇒ Object
88 89 90 |
# File 'lib/beyond_api/session.rb', line 88 def product_attribute_definitions BeyondApi::ProductAttributeDefinitions.new(self) end |
#products ⇒ Object
96 97 98 |
# File 'lib/beyond_api/session.rb', line 96 def products BeyondApi::Products.new(self) end |
#products_view ⇒ Object
92 93 94 |
# File 'lib/beyond_api/session.rb', line 92 def products_view BeyondApi::ProductsView.new(self) end |
#script_tags ⇒ Object
100 101 102 |
# File 'lib/beyond_api/session.rb', line 100 def BeyondApi::ScriptTags.new(self) end |
#shipping_zones ⇒ Object
104 105 106 |
# File 'lib/beyond_api/session.rb', line 104 def shipping_zones BeyondApi::ShippingZones.new(self) end |
#shop ⇒ Object
108 109 110 |
# File 'lib/beyond_api/session.rb', line 108 def shop BeyondApi::Shop.new(self) end |
#signers ⇒ Object
112 113 114 |
# File 'lib/beyond_api/session.rb', line 112 def signers BeyondApi::Signers.new(self) end |
#token ⇒ Object
116 117 118 |
# File 'lib/beyond_api/session.rb', line 116 def token BeyondApi::Token.new(self) end |
#users ⇒ Object
120 121 122 |
# File 'lib/beyond_api/session.rb', line 120 def users BeyondApi::Users.new(self) end |
#variations ⇒ Object
124 125 126 |
# File 'lib/beyond_api/session.rb', line 124 def variations BeyondApi::Variations.new(self) end |
#webhook_subscriptions ⇒ Object
128 129 130 |
# File 'lib/beyond_api/session.rb', line 128 def webhook_subscriptions BeyondApi::WebhookSubscriptions.new(self) end |